package yyj.UserApect;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.*;
import org.springframework.stereotype.Component;

@Component
@Aspect
public class UserAspect {

    @Pointcut(value = "execution(* yyj.service.*.*(..))")
    public void pointCut(){}

    @Before(value ="pointCut()" )
    public void doBefore(JoinPoint joinPoint){
        String name = joinPoint.getSignature().getName();
        Object[] getArgs = joinPoint.getArgs();
        System.out.println(name+"/////"+getArgs.toString());
    }

    @After(value = "pointCut()")
    public void doAfter(JoinPoint joinPoint){
        String name = joinPoint.getSignature().getName();
        System.out.println(name+"/////");
    }

    @AfterReturning(value = "pointCut()",returning = "result")
    public void oui(JoinPoint joinPoint,Object result){
        System.out.println(result);
    }

    @AfterThrowing
    public void exe(JoinPoint joinPoint){}
    @Around(value = "pointCut()")
    public void eee(JoinPoint joinPoint){}
}
